﻿using RFID.BLL;
using System;
using System.Web.UI;

namespace RFID.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var result = CardInfoBLL.Login(txtName.Text, txtPwd.Text);
            if (result.Status)
            {
                Session["CardID"] = result.Data.Id;
                Response.Redirect("pages/default.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('" + result.Message + "')</script>");
            }
        }
    }
}